In this work I’m exploring the tertriary education attament in the EU.

Obtaining Data

library(tidyverse)
library(plotly)
library(eurostat)
library(janitor)
library(knitr)
library(kableExtra)
library(magrittr)
library(glue)

edu.data <- get_eurostat(id='tgs00105')
## Reading cache file /tmp/Rtmp52Lezm/eurostat/tgs00105_date_code_TF.rds
## Table  tgs00105  read from cache file:  /tmp/Rtmp52Lezm/eurostat/tgs00105_date_code_TF.rds

The data comes directly from Eurostat. Let’s see how it looks like:

edu.data %>% glimpse
## Observations: 4,359
## Variables: 7
## $ unit    <fct> PC, PC, PC, PC, PC, PC, PC, PC, PC, PC, PC, PC, PC, PC...
## $ isced11 <fct> ED5-8, ED5-8, ED5-8, ED5-8, ED5-8, ED5-8, ED5-8, ED5-8...
## $ age     <fct> Y30-34, Y30-34, Y30-34, Y30-34, Y30-34, Y30-34, Y30-34...
## $ sex     <fct> F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, ...
## $ geo     <fct> AT1, AT2, AT3, BE1, BE2, BE3, BG3, BG4, CH0, CY0, CZ0,...
## $ time    <date> 2007-01-01, 2007-01-01, 2007-01-01, 2007-01-01, 2007-...
## $ values  <dbl> 24.8, 14.1, 17.7, 49.7, 47.2, 43.6, 28.2, 38.5, 29.7, ...
edu.data %>% summary
##  unit       isced11         age       sex           geo      
##  PC:4359   ED5-8:4359   Y30-34:4359   F:1453   AT1    :  36  
##                                       M:1453   AT2    :  36  
##                                       T:1453   AT3    :  36  
##                                                BE1    :  36  
##                                                BE2    :  36  
##                                                BE3    :  36  
##                                                (Other):4143  
##       time                values     
##  Min.   :2007-01-01   Min.   : 2.60  
##  1st Qu.:2010-01-01   1st Qu.:24.80  
##  Median :2013-01-01   Median :34.50  
##  Mean   :2012-07-19   Mean   :34.31  
##  3rd Qu.:2016-01-01   3rd Qu.:43.10  
##  Max.   :2018-01-01   Max.   :70.40  
##                       NA's   :126

We’ll compare the percentage of members populations with terriary educational level attained between 2018 and 2017. We’ll compute the percentage difference which will give us a way to quantify the 11 years change.

edu.data %<>% filter(time == "2007-01-01" | time == "2018-01-01") %>%
  select(-unit, -isced11, -age) %>%
  group_by(geo, time) %>%
  summarise(values=mean(values, na.rm = TRUE)) %>%
  ungroup %>%
  spread(time, values) %>%
  mutate(diff=.[["2018-01-01"]] - .[["2007-01-01"]]) %>%
  drop_na() %>%
  mutate(nuts_id=as.character(geo)) %>%
  select(-geo) %>%
  filter(nuts_id %in% maps$NUTS_ID)

Let’s look at the data:

edu.data %>%
  arrange(nuts_id) %>%
  kable %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) %>%
  scroll_box(width = "100%", height = "400px")
2007-01-01 2018-01-01 diff nuts_id
23.266667 43.73333 20.4666667 AT1
18.366667 38.16667 19.8000000 AT2
19.333333 38.13333 18.8000000 AT3
47.600000 56.26667 8.6666667 BE1
42.033333 48.16667 6.1333333 BE2
38.033333 42.50000 4.4666667 BE3
22.200000 25.76667 3.5666667 BG3
29.966667 40.30000 10.3333333 BG4
36.500000 55.00000 18.5000000 CH0
46.200000 56.90000 10.7000000 CY0
13.333333 33.86667 20.5333333 CZ0
29.966667 39.06667 9.1000000 DE1
28.833333 39.83333 11.0000000 DE2
37.433333 49.70000 12.2666667 DE3
23.433333 23.46667 0.0333333 DE4
25.450000 37.13333 11.6833333 DE5
30.066667 46.20000 16.1333333 DE6
28.900000 38.10000 9.2000000 DE7
22.666667 26.06667 3.4000000 DE8
21.433333 29.00000 7.5666667 DE9
22.866667 31.33333 8.4666667 DEA
23.100000 31.60000 8.5000000 DEB
18.800000 29.33333 10.5333333 DEC
35.900000 31.63333 -4.2666667 DED
17.866667 20.53333 2.6666667 DEE
20.000000 27.60000 7.6000000 DEF
28.300000 29.06667 0.7666667 DEG
38.166667 49.16667 11.0000000 DK0
33.600000 47.46667 13.8666667 EE0
31.633333 53.36667 21.7333333 EL3
17.866667 31.86667 14.0000000 EL4
26.400000 43.86667 17.4666667 EL5
20.866667 37.70000 16.8333333 EL6
43.700000 47.70000 4.0000000 ES1
52.833333 51.76667 -1.0666667 ES2
50.100000 49.40000 -0.7000000 ES3
38.300000 39.00000 0.7000000 ES4
38.733333 44.03333 5.3000000 ES5
34.400000 33.26667 -1.1333333 ES6
33.033333 35.60000 2.5666667 ES7
47.400000 44.30000 -3.1000000 FI1
53.266667 59.80000 6.5333333 FR1
37.700000 45.06667 7.3666667 FRB
29.533333 33.30000 3.7666667 FRC
30.900000 32.33333 1.4333333 FRD
34.300000 40.80000 6.5000000 FRE
36.433333 37.93333 1.5000000 FRF
38.666667 49.10000 10.4333333 FRG
45.333333 45.50000 0.1666667 FRH
33.533333 42.46667 8.9333333 FRI
43.800000 45.80000 2.0000000 FRJ
44.133333 48.00000 3.8666667 FRK
38.000000 42.86667 4.8666667 FRL
16.833333 34.16667 17.3333333 HR0
31.166667 47.20000 16.0333333 HU1
15.233333 25.20000 9.9666667 HU2
15.666667 27.90000 12.2333333 HU3
45.200000 56.13333 10.9333333 IE0
36.333333 52.16667 15.8333333 IS0
20.033333 32.03333 12.0000000 ITC
15.400000 21.33333 5.9333333 ITF
13.666667 21.00000 7.3333333 ITG
19.200000 33.23333 14.0333333 ITH
22.666667 29.93333 7.2666667 ITI
36.466667 57.76667 21.3000000 LT0
35.266667 56.16667 20.9000000 LU0
25.700000 42.83333 17.1333333 LV0
12.200000 33.36667 21.1666667 MK0
20.800000 34.30000 13.5000000 MT0
32.933333 42.20000 9.2666667 NL1
29.833333 42.56667 12.7333333 NL2
38.200000 54.03333 15.8333333 NL3
33.066667 47.20000 14.1333333 NL4
43.733333 50.66667 6.9333333 NO0
27.100000 47.20000 20.1000000 PL2
23.333333 39.13333 15.8000000 PL4
22.700000 46.20000 23.5000000 PL5
20.766667 41.13333 20.3666667 PL6
25.733333 45.26667 19.5333333 PL7
24.966667 44.46667 19.5000000 PL8
42.066667 57.46667 15.4000000 PL9
19.766667 33.86667 14.1000000 PT1
12.966667 24.76667 11.8000000 RO1
10.033333 16.30000 6.2666667 RO2
19.700000 35.43333 15.7333333 RO3
13.500000 18.53333 5.0333333 RO4
44.866667 55.76667 10.9000000 SE1
40.566667 51.50000 10.9333333 SE2
32.800000 44.16667 11.3666667 SE3
31.266667 43.53333 12.2666667 SI0
14.766667 37.80000 23.0333333 SK0
14.766667 36.40000 21.6333333 TR1
12.533333 30.90000 18.3666667 TR2
12.966667 30.70000 17.7333333 TR3
11.933333 27.80000 15.8666667 TR4
18.466667 35.30000 16.8333333 TR5
12.100000 24.56667 12.4666667 TR6
10.900000 23.20000 12.3000000 TR7
9.400000 24.86667 15.4666667 TR8
12.333333 26.13333 13.8000000 TR9
8.800000 21.66667 12.8666667 TRA
8.366667 22.30000 13.9333333 TRB
5.300000 16.86667 11.5666667 TRC
32.933333 40.20000 7.2666667 UKC
33.100000 43.03333 9.9333333 UKD
30.266667 42.00000 11.7333333 UKE
32.900000 43.93333 11.0333333 UKF
34.733333 39.30000 4.5666667 UKG
36.000000 43.16667 7.1666667 UKH
48.700000 65.60000 16.9000000 UKI
38.500000 50.66667 12.1666667 UKJ
38.500000 45.73333 7.2333333 UKK
32.866667 40.23333 7.3666667 UKL
45.166667 54.40000 9.2333333 UKM
36.200000 38.66667 2.4666667 UKN

11 year percentage difference 2018-2017

plot_ly(
  x = edu.data$nuts_id,
  y = edu.data$diff
)
## No trace type specified:
##   Based on info supplied, a 'bar' trace seems appropriate.
##   Read more about this trace type -> https://plot.ly/r/reference/#bar

Levels in 2018

plot_ly(
  x = edu.data$nuts_id,
  y = edu.data[["2018-01-01"]]
)
## No trace type specified:
##   Based on info supplied, a 'bar' trace seems appropriate.
##   Read more about this trace type -> https://plot.ly/r/reference/#bar